<template>
  <div class="login-page">
     <van-field v-model="ruleForm.username" label="用户名" />
     <van-field v-model="ruleForm.pass" label="密码" />
     <van-button type="primary" @click="handleSubmit">登录</van-button>
     <p @click="goRegister">去注册</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        username: "",
        pass: ""
      },
    };
  },
  created() {

  },
  methods: {
    goRegister(){
      this.$router.push({name:'register'})
    },
    async handleSubmit() {
      if (!this.ruleForm.username) {
        this.$toast('请输入用户名/账号');
        return false
      }
      if (!this.ruleForm.pass) {
        this.$toast('请输入密码');
        return false
      }
      let res = await this.$http.login({...this.ruleForm});
      if (res) {

      }
    }
  }
};
</script>

<style>
.login-page {
  width: 100%;
  height: 100vh;
}
.div{
  width: 6rem;
  height: 1rem;
  background: #eee;
}
</style>
